package com.ruoyi.project.hcy.administrations.controller;

import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.framework.web.page.TableDataInfo;
import com.ruoyi.project.hcy.administrations.domain.Dimission;
import com.ruoyi.project.hcy.administrations.domain.Invite;
import com.ruoyi.project.hcy.administrations.service.IDimissionService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * @ClassName ApproveController
 * @Author 金刚芭比
 * @Date 2020/9/17 10:55
 * @Version 1.0
 */
@Controller
@RequestMapping("/hcy/dimission")
public class DimissionController extends BaseController {

    @Autowired
    private IDimissionService dimissionService;

    private String prefix="hcy/administrations";

    @GetMapping
    public String toDimission(){
        return prefix + "/dimission";
    }

    @RequiresPermissions("hcy:dimission:list")
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list() {
        startPage();
        List<Dimission> list = dimissionService.selectDimissionAll("待审批..");
        return getDataTable(list);
    }

    @GetMapping("/add")
    public String toaddDimission(){
        return prefix + "/adddimission";
    }

    @RequiresPermissions("hcy:dimission:add")
    @PostMapping("/add")
    @ResponseBody
    public AjaxResult addDimission(Dimission dimission){
        return toAjax(dimissionService.insertDimission(dimission));
    }



}
